using namespace std;
#include<iostream>
typedef long long ll;
bool palindrome(string s)
{
    ll left = 0;
    ll right = s.size() - 1;
    while (left < right)
    {
        if (s[left] == s[right])
        {
            left++;
            right--;
        }
        else
        {
            return false;
        }

    }
    return true;
}
int main()
{
    string s;
    cin >> s;
    ll len = s.size();
    ll max = 0;
    for (ll i = 0; i < len; i++)
    {
        for (ll j = i; j < len; j++)
        {
            string s1;
            for (ll x = i; x <= j; x++)
            {
                s1 += s[x];
            }
            cout << s1 << endl;
            cout << s1.size() << endl;
            if (!palindrome(s1))
            {
                if (s1.size() > max)
                {
                    max = s1.size();
                }
            }
        }
    }
    cout << max << endl;
    return 0;
}